package com.etime.yqtsponsor.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.etime.yqtsponsor.pojo.UserBehavior;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;

@Repository
public interface UserBehaviorMapper extends BaseMapper<UserBehavior> {

    @Delete("DELETE" +
            "FROM" +
            "user_behavior" +
            "WHERE" +
            "activeId = #{id}" +
            "AND" +
            "type in (2,3)")
    int deleteParticipator(@Param("id") int id);

    @Select("SELECT" +
            "* " +
            "FROM " +
            "user_behavior " +
            "${ew.customSqlSegment}"
            )
//    UserBehavior selectByActiveId(@Param("id") int id);
    Page<UserBehavior>selectByActiveId(Page<UserBehavior> page,@Param(Constants.WRAPPER) QueryWrapper<UserBehavior> wrapper);
}
